package yt.demo.appcoresystem.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import yt.demo.appcommondb.base.BaseEntity;
import java.util.Date;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@Schema(name = "SystemUser", description = "系统用户")
public class SystemUser extends BaseEntity<SystemUser> {

    @TableId
    @Schema(name = "id", description = "主键ID")
    @NotNull(groups = UpdateGroup.class, message = "id不能为空") // 更新时确保此字段不能为空
    private Long id;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "昵称")
    private String nickname;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "盐")
    private String salt;

    @Schema(description = "手机")
    private String phone;

    @Schema(description = "邮箱")
    private String email;

    @Schema(description = "用户状态 1正常 2不可用")
    private Integer  status;

    @Schema(description = "性别 1男 2女")
    private Integer  sex;

    @Schema(description = "用户头像")
    private String avatar;

    @Schema(description = "登录ip")
    private String loginIp;

    @Schema(description = "登陆时间")
    private Date loginTime;

    @TableField(exist = false)
    private Long deptId;

    @JsonProperty("dept_ids")
    @TableField(exist = false)
    private List<Long> deptIds;

    @JsonProperty("dept_name")
    @TableField(exist = false)
    private String deptName;

    @JsonProperty("role_ids")
    @TableField(exist = false)
    private List<Long> roleIds;

    @JsonProperty("role_name")
    @TableField(exist = false)
    private String roleName;

}
